<?php

namespace app\api\controller;

use app\api\model\wanlshop\Category;
use app\common\controller\Api;
use think\Db;


/**
 * 认证接口
 */
class Project extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    //项目列表
    public function lists()
    {
        $pid = $this->request->param('pid');

        if(!$pid){
            $this->error('参数错误');
        }

        $list = Category::where(['pid'=>$pid,'type'=>'goods'])
            ->field('id,name,image')
            ->select();

        $this->success('ok',$list);
    }

    public function detail()
    {
        $id = $this->request->param('id');

        if(!$id){
            $this->error('参数错误');
        }

        $info = Category::where(['id'=>$id])
            ->field('id,name,image,range')
            ->find();

        $this->success('ok',$info);
    }


}
